package org.example.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.entity.WeatherWeather;
import org.springframework.stereotype.Service;
import org.example.mapper.WeatherWeatherMapper;


@Service
public class WeatherManager extends ServiceImpl<WeatherWeatherMapper, WeatherWeather> {
    private final WeatherWeatherMapper weatherWeatherMapper;

    public WeatherManager(WeatherWeatherMapper weatherWeatherMapper) {
        this.weatherWeatherMapper = weatherWeatherMapper;
    }

    public WeatherWeather selectByStationId(Long stationId) {
        return weatherWeatherMapper.selectOne(Wrappers.<WeatherWeather>lambdaQuery().eq(WeatherWeather::getStationId, stationId));
    }

    public int insert(WeatherWeather weatherWeather) {
        return weatherWeatherMapper.insert(weatherWeather);
    }
}
